package com.bdqn.crm.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;

/**
 * @TableName storage
 */
@TableName(value = "storage")
@Data
public class Storage implements Serializable {
    /**
     * 编号
     */
    @TableId(type = IdType.AUTO)
    private Long stkId;

    /**
     * 产品编号
     */
    private Long stkProdId;

    /**
     * 仓库
     */
    private String stkWarehouse;

    /**
     * 货位
     */
    private String stkWare;

    /**
     * 库存数量
     */
    private Integer stkCount;

    /**
     * 备注
     */
    private String stkMemo;

    @TableField(exist = false)
    private Product product;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Storage other = (Storage) that;
        return (this.getStkId() == null ? other.getStkId() == null : this.getStkId().equals(other.getStkId()))
                && (this.getStkProdId() == null ? other.getStkProdId() == null : this.getStkProdId().equals(other.getStkProdId()))
                && (this.getStkWarehouse() == null ? other.getStkWarehouse() == null : this.getStkWarehouse().equals(other.getStkWarehouse()))
                && (this.getStkWare() == null ? other.getStkWare() == null : this.getStkWare().equals(other.getStkWare()))
                && (this.getStkCount() == null ? other.getStkCount() == null : this.getStkCount().equals(other.getStkCount()))
                && (this.getStkMemo() == null ? other.getStkMemo() == null : this.getStkMemo().equals(other.getStkMemo()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getStkId() == null) ? 0 : getStkId().hashCode());
        result = prime * result + ((getStkProdId() == null) ? 0 : getStkProdId().hashCode());
        result = prime * result + ((getStkWarehouse() == null) ? 0 : getStkWarehouse().hashCode());
        result = prime * result + ((getStkWare() == null) ? 0 : getStkWare().hashCode());
        result = prime * result + ((getStkCount() == null) ? 0 : getStkCount().hashCode());
        result = prime * result + ((getStkMemo() == null) ? 0 : getStkMemo().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", stkId=").append(stkId);
        sb.append(", stkProdId=").append(stkProdId);
        sb.append(", stkWarehouse=").append(stkWarehouse);
        sb.append(", stkWare=").append(stkWare);
        sb.append(", stkCount=").append(stkCount);
        sb.append(", stkMemo=").append(stkMemo);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}